<div class="container container-gary">
    <!-- member index -->
    <div class="m-ptb wrap clearfix">
{include file="common@public/_personal_left"}
          <div class="member-right">
              <div class="member-sign clearfix">
                  <b>我的信息</b>
                  <div class="address-span">
                    <input class="address-s-color" type="button" value="保存" id="btn"/>
                      <a href="javascript:history.back(-1)"><input type="button" value="取消"/></a>
                 </div>
              </div>
              <div class="member-order min-height">
                  <div class="member-t-gary clearfix">
                      <h3>公司资料</h3>
                  </div>
                  <div class="m-safe-info">
                      <div class="m-safe-enter clearfix">
                          <div class="m-safe-txt">公司名称：</div>
                          <div class="m-safe-right">
                              <input class="safe-input safe-w1" type="text" placeholder="公司名称" value="{$company_info.company}" id="company"/>
                              <span id="company_name" style="color: red" class="enter-prompt"></span>
                          </div>
                      </div>
                      <div class="m-safe-enter clearfix">
                          <div class="m-safe-txt">公司所在地：</div>
                          <select class="enter-select" id="province" name="province" onchange="region.changed(this, 2, 'city')" style="margin-left: 7px">
                              <option value="">请选择</option>
                              {foreach name="province" item="vo"}
                              <option value="{$vo.id}" {if condition="isset($company_info.provinceid) && ($vo.id eq $company_info.provinceid)"}selected{/if}>{$vo.name}</option>
                              {/foreach}
                          </select>
                          <select class="enter-select" id="city" name="city" onchange="region.changed(this, 3, 'area')">
                              <option value="">请选择</option>
                              {if condition="isset($city)"}
                              {foreach $city as $vo}
                              <option value="{$vo.id}" {if condition="$vo.id eq $company_info.cityid"}selected{/if}>{$vo.name}</option>
                              {/foreach}
                              {/if}
                          </select>
                          <select class="enter-select" id="area" name="town">
                              <option value="">请选择</option>
                              {if condition="isset($area)"}
                              {foreach $area as $vo}
                              <option value="{$vo.id}" {if condition="$vo.id eq $company_info.townid"}selected{/if}>{$vo.name}</option>
                              {/foreach}
                              {/if}
                          </select>
                          <span id="companyplace" style="color: red" class="enter-prompt"></span>
                      </div>
                      <div class="m-safe-enter clearfix">
                          <div class="m-safe-txt">详细地址：</div>
                          <div class="m-safe-right">
                              <input class="safe-input safe-w1" type="text" placeholder="上海市上海上海 " value="{$company_info.addr}" id="addr"/>
                              <span id="company_addr" style="color: red" class="enter-prompt"></span>
                          </div>
                      </div>
                      <div class="m-safe-enter clearfix">
                          <div class="m-safe-txt">公司性质：</div>
                          <div class="m-safe-right">
                              <select class="company-select" id="company_nature">
                                  <option value="">请选择</option>
                                  {foreach name="company_nature" item="vo"}
                                  {if condition="$company_info.company_nature eq $vo.id"}
                                  <option value="{$vo.id}" selected="selected">{$vo.company_nature}</option>
                                  {else /}
                                  <option value="{$vo.id}">{$vo.company_nature}</option>
                                  {/if}
                                  {/foreach}
                              </select>
                              <span id="nature" style="color: red" class="enter-prompt"></span>
                          </div>
                      </div>
                      <div class="m-safe-enter clearfix">
                          <div class="m-safe-txt">公司行业：</div>
                          <div class="m-safe-right">
                              <select class="company-select" id="industry">
                                  <option value="">请选择</option>
                                  {foreach name="industry" item="vo"}
                                  {if condition="$company_info.industry eq $vo.id"}
                                  <option value="{$vo.id}" selected="selected">{$vo.name}</option>
                                  {else /}
                                  <option value="{$vo.id}">{$vo.name}</option>
                                  {/if}
                                  {/foreach}
                              </select>
                              <span id="company_industry" style="color: red" class="enter-prompt"></span>
                          </div>
                      </div>
                  </div>
              </div>
          </div>
      </div>

  </div>

  <!-- footer -->
  <!--#include file="includes/foot.html"-->

<!-- menu -->

 <script type="text/javascript" src="/public/static/home/js/jquery-1.11.1.min.js"></script>
 <script src="/public/static/home/js/region.js?r=1"></script>
<script src="/public/static/home/js/icheck.js"></script>
 <script type="text/javascript" src="/public/static/home/js/menu.js"></script>
<script>
    $('#company').blur(function() {
        $("#company_name").text("");
    });
    $('#province').blur(function() {
        $("#companyplace").text("");
    });
    $('#city').blur(function() {
        $("#companyplace").text("");
    });
    $('#addr').blur(function() {
        $("#company_addr").text("");
    });
    $('#company_nature').blur(function() {
        $("#nature").text("");
    });
    $('#industry').blur(function() {
        $("#company_industry").text("");
    });
      $('#btn').click(function(){
          var company=$('#company').val();
          var province=$('#province').val();
          var city=$('#city').val();
          var town=$('#area').val();
          var addr=$('#addr').val();
          var company_nature=$('#company_nature').val();
          var industry=$('#industry').val();
          if(company=='' || company==' '){
              $('#company_name').text('公司名称不能为空');
              document.getElementById('company').focus();
              return false;
          }else if(province==''){
              $('#companyplace').text('请选择省份');
              document.getElementById('province').focus();
              return false;
          }else if(city==''){
              $('#companyplace').text('请选择城市');
              document.getElementById('city').focus();
              return false;
          }else if(addr=='' || addr==' '){
              $('#company_addr').text('请输入详细地址');
              document.getElementById('addr').focus();
              return false;
          }else if(company_nature==''){
              $('#nature').text('请选择公司性质');
              document.getElementById('company_nature').focus();
              return false;
          }else if(industry==''){
              $('#company_industry').text('请选择公司行业');
              document.getElementById('industry').focus();
              return false;
          }else{
              $.ajax({
                url:"{:url('member/Memberinfo/companyEdit')}",
                type:"post",
                data:{'company':company,'province':province,'city':city,'town':town,'addr':addr,'company_nature':company_nature,'industry':industry},
                success:function (data) {
                  if(data==1){
                      window.location.href="{:url('member/Memberinfo/index')}";
                  }
                   if(data==2){
                     alert('修改失败');
                   }
              }
              });
          }
      });

    $(function(){
      //top select
      $(".top-select").mouseover(function () {
        $(".top-s-text").show();
      })
      $(".top-select").mouseout(function () {
        $(".top-s-text").hide();
      })
      $(".top-s-text div").click(function () {
        var selecttext = $(this).text();
        $(".top-s-head span").text(selecttext);
        $(this).parent(".top-s-text").hide()
      })
      // top code
      var turn = function(target,time,opts){
      target.find('.top-code').hover(function () {
            $(this).find('.top-c-img').stop().animate(opts[0], time, function () {
			$(this).hide().next().show();
			$(this).next().animate(opts[1],time);
	   });
	   },function(){
	        $(this).find('.top-c-text').animate(opts[0], time, function () {
			    $(this).hide().prev().show();
			    $(this).prev().animate(opts[1],time);
		 });
	     });
        }
        var verticalOpts = [{'width':0},{'width':'80px'}];
        turn($('.top-right'), 150, verticalOpts);
        //menu all
        $(".menu-all div").mouseenter(function () {
            $(this).addClass("current");
            $(".submenu").show();
        })
       $(".menu-all div").mouseleave(function () {
            $(this).removeClass("current");
            $(".submenu").hide();
        })
        $(".submenu").mouseenter(function(){
           $(this).show();
           $(".menu-all div").addClass("current")
        })
        $(".submenu").mouseleave(function(){
           $(this).hide();
           $(".menu-all div").removeClass("current")
        })
        //left submenu
        $(".submenu ul li").each(function () {
            var $this = $(this);
            var $children = $this.find('.submenu-pro');
            var $otherChildren = $this.siblings('li').find('.submenu-pro');
            var $childrenList = $children.children('.submenu-total');
            $this.on({
                'mouseenter': function () {
                    $children.css({ 'display': 'block', 'width': 221 * parseInt($childrenList.size()) });
                    $otherChildren.css('display', 'none');
                },
                'mouseleave': function () {
                    $children.css('display', 'none');
                }
            })
        });

        //member left
        $(".member-l-title").click(function(){
           $(this).parent(".member-l-list").toggleClass("m-current");
           $(this).parent(".member-l-list").find("ul").slideToggle()
        })
    })
</script>
</body>
</html>